#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

void solve()
{
	int n;
	cin>>n;
	if(n==1)
	{
		cout<<1<<endl;
		return ;
	}
	vector<int> vis(n+5);
	for(int i=1;i<=n;i++)
	{
		if(vis[i]) continue;
		int j=i;
		while(j<=n)
		{
			cout<<j<<' ';
			vis[j]=1;
			j*=2;
		}
	} 
	cout<<endl;
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

